<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>使用creatRef 管理refs</title>
    <!--    react 核心库-->
    <script type="text/javascript" src="./yl/react.development.js"></script>
    <!--    用于支持react操作dom-->
    <script type="text/javascript" src="./yl/react-dom.development.js"></script>
    <!--    用于将jsx 转为 js-->
    <script type="text/javascript" src="./yl/babel.min.js"></script>
    <!--    用于对组件标签进行限制-->
    <script type="text/javascript" src="./yl/prop-types.js"></script>

</head>
<body>


<div id="app"></div>
<script type="text/babel">
    class Person extends React.Component {

       state={age:12}
        //高阶函数
        hs=(name)=>{
           return (c)=>{
               this.setState({
                   [name]:c.target.value
               })
           }
        }
        render() {
            return <div>
                <label>
                    age:<input  onChange={this.hs('age')} /><br/>
                </label>
            </div>
        }
    }
    ReactDOM.render(<Person age="16" name="123"/>, document.getElementById('app'))
</script>
</body>
</html>
